#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 20;
int n;
struct Square {
    int lx, ly, rx, ry;
    inline void read() {
        cin>>lx>>ly;
        rx=lx;ry=ly;
    }
    inline bool operator<(const Square &b) const { return ry < b.ry; }
    inline Square operator+(const Square &b) const { return {min(lx, b.lx), min(ly, b.ly), max(rx, b.rx), max(ry, b.ry)}; }
} a[N];
bool vis[N];
int dis(int d,int e,int f,int g){
    if(f>e)return f-e;
    if(d>g)return d-g;
    return 0;
}
inline bool calc(int x, int y) { return dis(a[x].lx,a[x].rx,a[y].lx,a[y].rx)+dis(a[x].ly,a[x].ry,a[y].ly,a[y].ry)<=2;}
struct SegmentTree {
    vector<int> vec[N << 2], vec2[N << 2];
    void update(int u, int L, int R, int l, int r, int v) {
        if (L > r || R < l) return;
        vec2[u].push_back(v);
        if (L >= l && R <= r) {
            vec[u].push_back(v);
            return;
        }
        int M = L + R >> 1;
        update(u << 1, L, M, l, r, v), update(u << 1 | 1, M + 1, R, l, r, v);
    }
    bool merge(int u, int L, int R, int l, int r, int v) {
        if (L > r || R < l) return 0;
        bool flag = 0;
        for (int i = vec[u].size() - 1; ~i; i = vec[u].size() - 1) {
            if (vis[vec[u][i]]) {
                vec[u].pop_back();
                continue;
            }
            if (!calc(vec[u][i], v)) break;
            a[v] = a[v] + a[vec[u][i]], vis[vec[u][i]] = 1;
            vec[u].pop_back();
            flag = 1;
        }
        if (L >= l && R <= r) {
            for (int i = vec2[u].size() - 1; ~i; i = vec2[u].size() - 1) {
                if (vis[vec2[u][i]]) {
                    vec2[u].pop_back();
                    continue;
                }
                if (!calc(vec2[u][i], v)) break;
                a[v] = a[v] + a[vec2[u][i]], vis[vec2[u][i]] = 1;
                vec2[u].pop_back();
                flag = 1;
            }
            return flag;
        }
        int M = L + R >> 1;
        return flag | merge(u << 1, L, M, l, r, v) | merge(u << 1 | 1, M + 1, R, l, r, v);
    }
} seg;
inline bool cmp(Square a, Square b) { return a.lx != b.lx ? a.lx < b.lx : (a.rx != b.rx ? a.rx < b.rx : (a.ly != b.ly ? a.ly < b.ly : a.ry < b.ry)); }
int main() {
    freopen("grid.in","r",stdin);
    freopen("grid.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int u,v;
    cin>>u>>v>>n;
    for(int i=1;i<=n;i++)a[i].read();
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        while(seg.merge(1,1,max(u,v)+2,a[i].lx,a[i].rx+2,i));
        seg.update(1,1,max(u,v)+2,a[i].lx,a[i].rx+2,i);
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++)
        if (!vis[i]) a[++cnt] = a[i];
    long long ans=0;
    for (int i = 1; i <= cnt; i++){
        ans=ans+1ll*(a[i].rx-a[i].lx+1)*(a[i].ry-a[i].ly+1);
    }
    cout<<ans<<"\n";
    return 0;
}
